<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>添加用户</title>
		<%@include  file="../css.jsp"%>
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/css/webuploader.css" />
		<link rel="stylesheet" href="${jpath}/static/plugins/webuploader/style.css" />
	
	</head>

	<body>
						<div class="page-header">
							<h1>
								用户
								<small>
									<i class="icon-double-angle-right"></i>
									添加
								</small>
							</h1>
						</div><!-- /.page-header -->
						<div class="row">
							<div class="col-xs-12">
								<form class="form-horizontal" id="usForm"  method="post" action="" role="form">
									
									<input type="hidden" id="UsersId" name="UsersId" value="${UsList.usersId }" />	
									
									<input type="hidden" id="state" name="state" value="${state }" />
									
									<input type="hidden" id="UserIndustryRelationsID" name="UserIndustryRelationsID" value="${UsList.userIndustryRelationsID }" />
									
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">用户名</label>

										<div class="col-sm-9">
											<input type="text" id="UsersName" name="UsersName" value="${UsList.usersName }" placeholder="用户名" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">电话</label>
										<div class="col-sm-9">
											<input type="text" id="phone" name="phone" value="${UsList.phone }" placeholder="电话"  class="col-xs-10 col-sm-5" />
										</div>
									</div>
								 
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">用户分类</label>
										<div class="col-sm-9">
											<input type="hidden" 
											on_type="comboxSelectOne" 
											id="ClassificationId" 
											name="ClassificationId"  
											no_name="ClassificationName"
											value="${UsList.classificationId }" 
											loadUrl="${jpath}/Use/findCf"
											parMs="{}"
											/>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">用户行业</label>
										<div class="col-sm-9">  
											<input type="hidden" 
											on_type="comboxSelectTow" 
											id="UserIndustryId" 
											name="UserIndustryId"  
											no_name="IndustryName"
											value="${UsList.userIndustryId}" 
											loadUrl="${jpath}/Use/findIndustry"
											parMs="{}"
											/>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">企业名称</label>
										<div class="col-sm-9">
											<input type="text" id="EnterpriseName" name="EnterpriseName" value="${UsList.enterpriseName }"  placeholder="企业名称" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">用户积分</label>
										<div class="col-sm-9">
											<input type="text" id="UserIntegral" name="UserIntegral"  value="${UsList.userIntegral }"  placeholder="用户积分" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">登录编号</label>
										<div class="col-sm-9">
											<input type="text" id="LoginId" name="LoginId" value="${UsList.loginId }"  placeholder="登录编号" class="col-xs-10 col-sm-5" />
										</div>
									</div>
									
									<div class="form-group">
										<div class="row">
											<label class="col-sm-3 control-label no-padding-right" for="form-field-1">用户附件</label>
											<div class="col-sm-9">
												
											</div>
										</div>
										<div class="row">
											<div class="col-sm-3"></div>
											<div class="col-sm-9" style="width:auto !important;">
												<div class="table-responsive">
													<table id="sample-table-1" class="table table-striped table-bordered table-hover">
														<thead>
															<tr>
																<th>附件名称</th>
																<th>附件大小</th>
																<th>上传时间</th>
																<th>操作</th>
																<th>附件下载</th>
															</tr>
														</thead>
														<tbody></tbody>
													</table>
												</div><!-- /.table-responsive -->
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1">附件</label>
										<input type='hidden' id='AttachmentId' name='AttachmentId'  value=""/>
										<div class="col-sm-6">
											<div id="wrapper" style="margin: 0 0 1rem -0.4rem !important ;">
										        <div id="container">
										            <!--头部，相册选择和格式选择-->
										            <div id="uploader">
										                <div class="queueList">
										                    <div id="dndArea" class="placeholder">
										                        <div id="filePicker"></div>
										                        <p>或将照片拖到这里，单次最多可选300张</p>
										                    </div>
										                </div>
										                <div class="statusBar" style="display:none;">
										                    <div class="progress">
										                        <span class="text">0%</span>
										                        <span class="percentage"></span>
										                    </div><div class="info"></div>
										                    <div class="btns">
										                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
										                    </div>
										                </div>
										            </div>
										        </div>
										    </div>
									    </div>
									    <label class="col-sm-3"></label>
									</div>
									<div class="clearfix form-actions" style="background-color:  #E4E6E9">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" id="submitBtn"  type="button">
												<i class="icon-ok bigger-110"></i>
												提交
											</button>

											&nbsp; &nbsp; &nbsp;
											<button class="btn" id="ss" type="reset">
												<i class="icon-undo bigger-110"></i>
												刷新
											</button>
										</div>
									</div>
								</form>
							</div><!-- /.col -->
						</div><!-- /.row -->
						
<%@include  file="../js.jsp"%>

<script type="text/javascript" src="${jpath}/static/plugins/webuploader/dist/webuploader.js"></script>
<script type="text/javascript" src="${jpath}/static/plugins/webuploader/upload.js"></script>
<script type="text/javascript">

	var colM = 	[{
					name:"AttachmentName"
				},{
					name:"AttachmentSize"
				},{
					name:"UploadTime"
				},{
					name:"AttachmentId",
					cl:function(index,val){
						var data="<div class='btn-group'>";
						data+="<button class='btn btn-xs btn-danger' onclick='delel(\""+val+"\")' ><i class='icon-trash bigger-120'></i></button>";
						data+="</div>";
						return data;
					}
				},{
					name:"AttachmentPath",
					cl:function(index,val){
						var data="<div class='btn-group'>";
						data+="<a class='btn btn-xs btn-info' href='${jpath}/Attachment/getFile?AttachmentPath="+val+"' target='_blank' ><i class='icon-download bigger-120'></i></a>";
						data+="</div>";
						return data;
					}
				}];
	var UsersId=$("input[id='UsersId']").val();	
	function delel(nowId){
		$.post("${jpath}/Attachment/Delel",{AttachmentId:nowId},function(data){
				console.log(data);
				var json=$.parseJSON(data);
				alert(json.resMsg);
				$("#sample-table-1").loadTbl(colM,{UsersId:UsersId},"${jpath}/Use/ShowAtt",false);
			}
		);
	}
	$(function(){
		$("#sample-table-1").loadTbl(colM,{UsersId:UsersId},"${jpath}/Use/ShowAtt",false);
		$("#usForm").loadCombox("comboxSelectOne");
		$("#usForm").loadCombox("comboxSelectTow");
		//$.loadComboxDom("usForm","comboxSelectOne");
		//$.loadComboxDom("usForm","comboxSelectTow");
		
		$("#submitBtn").click(function(){
			var jsonForms=getForm("#usForm");
			$.post("${jpath}/Use/UpdateOrAdd",jsonForms,function(data){
					console.log(data);
					var json=$.parseJSON(data);
					$("#ss").click();
					alert(json.resMsg);
					location.href="${jpath}/usercontent";
				}
			);
		});
	});
	
</script>

</body>
</html>
